package com.yzd.learnjava.arrays;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.yzd.learnjava.util.Print;

public class ContainerComparion {
	public static void main(String[] args) {
		BerylliumSphere[] spheres = new BerylliumSphere[10];
		for(int i = 0 ; i < 5 ; i++) {
			spheres[i] = new BerylliumSphere();
		}
		
		Print.print(Arrays.toString(spheres));
		Print.print(spheres[4]);
		
		List<BerylliumSphere> spheresList = new ArrayList<BerylliumSphere>();
		for(int i = 0 ; i < 5 ; i++) {
			spheresList.add(new BerylliumSphere());
		}
		Print.print(spheresList);
		Print.print(spheresList.get(4));
		
		int[] integers = {0,1,2,3,4,5};
		Print.print(Arrays.toString(integers));
		Print.print(integers[4]);
		
		List<Integer> intList = new ArrayList<Integer>(Arrays.asList(0,1,2,3,4,5));
		intList.add(97);
		Print.print(intList);
		Print.print(intList.get(4));
		
	}
}

class BerylliumSphere{
	private static long counter ;
	private final long id = counter++;
	public String toString() {
		return "Sphere " + id;
	}
}
